package cn.com.bluemoon.daps.system.service;

import lombok.Builder;
import lombok.Getter;
import lombok.ToString;

import java.io.Serializable;

/**
 * 定义删除决策
 *
 * @author Jarod.Kong
 */
@FunctionalInterface
public interface RowDeletePredicate<KEY extends Serializable> {
    /**
     * 判断
     * true 可以执行删除
     * false 不可
     */
    public Result<KEY> predicate(KEY key);

    @Builder
    @Getter
    @ToString
    public class Result<K extends Serializable> {
        private K key;
        private String message;
        private boolean canDelete;
    }
}
